package com.gongzonqiang.controller.client;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.github.pagehelper.PageInfo;
import com.gongzonqiang.pojo.Category;
import com.gongzonqiang.service.NoticeService;

/**
 * 分类controller
 * @author youjie
 *2018-9-23 20:43:48
 */
@RestController
@RequestMapping("/client/category")
public class CategoryController {
	
	@Autowired
	private NoticeService noticeService;
	
	/**
	 * 获取分类列表
	 * @return
	 */
	@RequestMapping("/listCategory")
	public List<Category> listCategory() {
		PageInfo<Category> pageInfo = noticeService.listCategory(1, 9999999);
		return pageInfo.getList();
	}
	
	/**
	 * 根据分类id获取分类信息
	 */
	@RequestMapping("/categoryById")
	public Category categoryById(Long categoryId) {
		Category category = noticeService.selectCategoryByCid(categoryId);
		return category;
	}
}
